import React from 'react'
import { connect } from 'react-redux'

function CountA(props) {

    function handClick() {
        props.sendAction()
    }

    return (
        <div>
            <button onClick={handClick.bind(this)}>+</button>
        </div>
    )
}

/**
 * 
 * @param{*} dispatch
 */
const mapDispatchToProps = (dispatch) => {
    return {
        // 利用dispatch发送一个action
        sendAction: () => {
            dispatch({ type: 'add_action' })
        }
    }
}

export default connect(null, mapDispatchToProps)(CountA)